
<div class="layui-form">



<a class="layui-btn  layui-btn-sm" href="../../case/view/detail-add.php?nav-itemed=<?echo $system_part?>&nid=<?echo $detail['nid']?>" target="_blank">新增项目</a>

<table class="layui-table">
  <colgroup>

	<col width="60" >
	<col >
	<col width="120" >
	<col >
	<col >
	<col width="145">
	<col width="120" >
    <col width="150" >
	<col width="100" >
	<col width="180" >


  </colgroup>
  <thead>
    <tr>
      <th>编号</th>
      <th>项目名称</th>
      <th>开始日期</th>
      <th>结束日期</th>
      <th>项目金额</th>
      <th>项目利润</th>
      <th>项目类型</th>
      <th>介绍人</th>
      <th>状态</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>




 <? $case = select_lines_all_items($table_Prefix."case","startdate desc","unit ='".$detail['nid']."'","") ;?>



 <?for($iix=0;$iix<count($case);$iix++){?>

      <tr >
      <td><?echo $iix+1 ?></td>
      <td><?echo $case[$iix]['name']?></td>
      <td><?echo substr($case[$iix]['startdate'],0,10)?></td>
	  <td><?echo substr($case[$iix]['enddate'],0,10)?> </td>
	  <td><?echo $case[$iix]['sum']?></td>


	  <td>
          <?if(isset($case[$iix]['profit']) && ($case[$iix]['status'] =="完成") ){?>
              <? echo $case[$iix]['profit'] ?>  【  <?echo round( $case[$iix]['profit']/$case[$iix]['sum'],3)*100?>% 】
          <?}?>

      </td>



          <td><?echo $case[$iix]['type']?></td>

<? $agent = select_one_line_all_items($table_Prefix."member","nid ='".$case[$iix]['agent']."'"); ?>
<td>
    <a  target="_blank" href="../member/detail-statistic.php?&nid=<?echo $case[$iix]['agent']?>">
    <?echo $agent['name']?>
    </a>
</td>


          <td><span  <?if($case[$iix]['status']=='进行中'){echo "class='layui-badge'  style='background-color:#ff9900'";}?>> <?echo $case[$iix]['status']?></span></td>

	  <td>


          <a href="../../case/view/detail-info.php?&nid=<? echo $case[$iix]['nid']?>&nowpageid=&sortby=&sys_part=case" target="_blank"
             class="layui-btn layui-btn-sm">
              <i class="layui-icon">&#xe642;</i>信息
          </a>


  <span class="layui-btn layui-btn-sm" onclick="show_iframe('mod-finance-add.php?unit=<?echo $detail['nid']?>&case=<?echo $case[$iix]['nid']?>','财务信息')" >收支</span>
      </td>

    </tr>




<?;}?>




  </tbody>
</table>

 </div>











<script>
<!--mod 部分删除数据的函数-->
function mode_del_item (id,table) {


con=confirm("请点击确认删除数据?"); //在页面上弹出对话框
if(con==true){


//传递id为数据的id，并且移除的时候会删除元素item+id

//先问一下是否删除

//显现遮罩图层
$(".message_layer").css({ 'display':'block'});
//锁定页面高度
$("body").height($(window).height()).css({
"overflow-y": "hidden"
});



//ajax删除数据
$.get('mod-delete.php?nid='+id+'&table='+table,null,function (msg) {
    //ajax请求,请求后执行下面代码
msg=$.trim(msg);

//删除遮罩图层
// console.log(返回内容)
// console.log(msg)

if ('deleted'==msg) {//返回1表示成功



$('#item'+id).remove();//把id为txx 的表格删除

//隐藏遮罩图层并解锁页面高度
$("body").css({'height':'','overflow':'auto'});
$(".message_layer").css({ 'display':'none'});


} else {//否则弹出错误信息

alert("删除数据失败，请刷新页面后重试");

//隐藏遮罩图层并解锁页面高度
$("body").css({'height':'','overflow':'auto'});
$(".message_layer").css({ 'display':'none'});
}
});

}

}

</script>


